using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using MvvmIService.Services;

namespace MvvmIService.ViewModels;

public class MainPageViewModel : ObservableObject {
    private ITokenService _tokenService;

    public MainPageViewModel(ITokenService tokenService) {
        _tokenService = tokenService;
    }

    private string _json;

    public string Json {
        get => _json;
        set => SetProperty(ref _json, value);
    }

    private RelayCommand _getJsonCommand;

    public RelayCommand GetJsonCommand =>
        _getJsonCommand ??= new RelayCommand(async () =>
            Json = await _tokenService.GetTokenJsonAsync());
}